/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

/**
 *
 * @author mattssok
 */
public class HTMLParserServlet {

    private static void readFile(String s) {
        String note = "", noteNr = "", styleLeft = "", styleLeftSize = "",  styleTop = "", styleTopSize = "", styleWidth = "", styleWidthSize = "",
                styleHeight = "", styleHeightSize = "", styleZ = "", styleZPos = "", text = "", col = "";
        try {
            //File file = new File(fileName);
            Scanner scanner = new Scanner(s).useDelimiter("[\\s]+");
            while (scanner.hasNext()) {
                note = scanner.next();
                noteNr = scanner.next();
                
                scanner.next();
                
                styleLeft = scanner.next();
                styleLeftSize = scanner.next();

                styleTop = scanner.next();
                styleTopSize = scanner.next();

                styleWidth = scanner.next();
                styleWidthSize = scanner.next();

                styleHeight = scanner.next();
                styleHeightSize = scanner.next();

                styleZ = scanner.next();
                styleZPos = scanner.next();
                scanner.next();

                text = scanner.next();

                scanner.next();

                col = scanner.next();
            }
            System.out.println(note + " " + noteNr + "\n" +
                    styleLeft + " " + styleLeftSize + "\n" +
                    styleTop + " " + styleTopSize + "\n" +
                    styleWidth + " " + styleWidthSize + "\n" +
                    styleHeight + " " + styleHeightSize + "\n" +
                    styleZ + " " + styleZPos + "\n" +
                    text + "\n" +
                    col);
            
            scanner.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        String str = "note 0 = left: 100px; top: 150px; width: 200px; height: 100px; z-index: 0 = TEXT = bleu";
        readFile(str);
    }
}

